1. Field
Embodiments relate generally to the field of object-oriented computer programs and devices.
2. Background
Object-oriented computer programs generally contain a significant number of virtual calls. Virtual calls may incur a significant performance penalty since they prevent the inlining of methods. For example, the receiver type of a virtual function or method call may not be known. Consequently, the call target of such a virtual function is not known either. Thus, compilers for object-oriented programming languages perform customization, in which several versions of the compiled code are created. Each version of the created code is customized to a specific receiver type. Compilation to a specific receiver type allows inlining of methods that are otherwise not inlineable.
However, object oriented programs contain complex type hierarchies. The number of possible receiver types and therefore the number of customized methods can be quite large. Thus, techniques for optimizing compiler technology in order to reduce the number of customized methods have been developed. An example of one such technique is the work by Craig Chambers and David Ungar, disclosed in their research paper entitled “Customization: Optimizing Compiler Technology for SELF, a Dynamically-Typed Object-Oriented Programming Language,” published in the Proceedings of the Association for Computing Machinery (ACM) Special Interest Group on Programming Languages (SIGPLAN) 1989 Conference on Programming language design and implementation, Volume 24, Issue 7, July 1989.
However, the general type of customization discussed in the above-noted research paper requires runtime checks and complex Virtual Machine (VM) support particularly for dynamically typed object oriented programs. A significant problem associated with the implementation of customization using SELF includes over-customization, as a customized version must be created for each different receiver type. Such over-customization causes memory bloat and increases compilation time of object-oriented programs due to unnecessary compilation.